package uestc.lj.gulishop.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.hibernate.validator.constraints.URL;
import uestc.lj.common.vaild.AddGroup;
import uestc.lj.common.vaild.ListValue;
import uestc.lj.common.vaild.UpdateGroup;
import uestc.lj.common.vaild.UpdateStatusGroup;

import javax.validation.constraints.*;
import java.io.Serializable;

/**
 * 品牌
 *
 * @author crazlee
 * @email peterlee0@163.com
 * @date 2021-05-21 16:56:25
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 品牌id
     */
    @TableId
    @Null(message = "增加品牌时品牌id必须为空",groups = {AddGroup.class})
    @NotNull(message = "新增品牌时品牌id必须不为空",groups = {UpdateGroup.class})
    private Long brandId;
    /**
     * 品牌名
     */
    @NotBlank(message = "名牌名不能为空！",groups = {AddGroup.class,UpdateGroup.class})
    private String name;
    /**
     * 品牌logo地址
     */
    @URL(message = "logo必须是一个合法的url地址",groups = {AddGroup.class,UpdateGroup.class})
    @NotEmpty(message = "商品logo不能为空",groups = {AddGroup.class})
    private String logo;

    /**
     * 介绍
     */
    private String descript;
    /**
     * 显示状态[0-不显示；1-显示]
     */
    @ListValue(vals={0,1},groups ={AddGroup.class, UpdateStatusGroup.class})
    @NotNull(message = "状态不能为空",groups = {AddGroup.class,UpdateStatusGroup.class})
    private Integer showStatus;
    /**
     * 检索首字母
     */
    @Pattern(regexp = "^[a-zA-Z]$", message = "检索首字母必须要符合a-z或A-Z且只能输入一个字母",groups = {AddGroup.class,UpdateGroup.class})
    @NotEmpty(message = "首字母不能为空",groups = {AddGroup.class})
    private String firstLetter;
    /**
     * 排序
     */
    @Min(value = 0, message = "排序必须是大于等于0的正整数",groups = {AddGroup.class,UpdateGroup.class})
    @NotNull(message = "排序值不能为空！",groups = {AddGroup.class,UpdateGroup.class})
    private Integer sort;

}
